package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.oss.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ybl
 * @version 1.9
 * @date 2021/5/21 13:18
 */
@Api(tags = "上传文件到oss服务器")
@RestController
@RequestMapping("/api/oss/file")
public class ApiOssController {

  @Autowired
  private OssService ossService;

  // 上传文件到阿里云
  @ApiOperation(value = "上传文件到阿里云服务器")
  @PostMapping("fileUpload")
  public Result upload(MultipartFile file){
    return Result.ok(ossService.upload(file));
  }
}
